package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.qo.GoodsQo;
import com.ruoyi.system.service.IGoodsService;
import com.ruoyi.system.service.InventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/system/inventory")
public class InventoryController extends BaseController
{
    @Autowired
    private InventoryService inventoryService;

    @GetMapping(value = "/{id}")
    public AjaxResult minAvail(@PathVariable("id") Integer goodId) {
        Integer num = inventoryService.selectMinInventory(goodId);
        if(num==null){
            return AjaxResult.success(0);
        }
        return AjaxResult.success(num);
    }
}


